24TJ

Technical details

Show code
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))
load(paste0("../data/5_wind_graph/", params$gdl_id, "_wind_graph.Rdata"))
col <- rep(RColorBrewer::brewer.pal(8, "Dark2"), times = ceiling(max(pam$sta$sta_id) / 8))

Settings used

All the results produced here are generated with (1) the raw geolocator data, (2) the labeled files of pressure and light and (3) the parameters listed below.

Show code
kable(gpr) %>% scroll_box(width = "100%")
gdl_id keep crop_start crop_end thr_dur extent_N extent_W extent_S extent_E map_scale map_max_sample map_margin prob_map_s prob_map_s_calib prob_map_thr shift_k kernel_adjust calib_lon calib_lat calib_1_start calib_1_end calib_2_start calib_2_end calib_2_lon calib_2_lat prob_light_w thr_prob_percentile thr_gs thr_as RingNo scientific_name common_name mass wing_span Color sta_id_winter
24TJ 9 2020-07-31 2021-06-05 0 51 -18 5 16 4 300 30 1 1.3 0.9 0 1.4 6.956946 44.97471 2020-07-31 2020-09-13 2018-05-04 2018-11-08 05:50:00 NA NA 0.09 0.95 120 100 NA Oenanthe oenanthe Northern wheatear NA NA #FFA15A 18

Pressure timeserie

The labeling of pressure data is illustrated with this figure. The black dots indicates the pressure datapoint not considered in the matching. Each stationary period is illustrated by a different colored line.

Show code
pressure_na <- pam$pressure %>%
  mutate(obs = ifelse(isoutlier | sta_id == 0, NA, obs))
p <- ggplot() +
  geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
  # geom_point(data = subset(pam$pressure, isoutlier), aes(x = date, y = obs), colour = "black") +
  # geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
  geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id > 0), aes(x = date, y = pressure0, col = factor(sta_id))) +
  theme_bw() +
  scale_colour_manual(values = col) +
  scale_y_continuous(name = "Pressure(hPa)")

ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)

Pressure calibration

Show code
pressure_ts_bind <- do.call("rbind", shortest_path_timeserie) %>%
  filter(!is.na(sta_id))

pam$pressure %>%
  left_join(pressure_ts_bind %>% dplyr::select(c("date", "pressure0")), by = "date") %>%
  mutate(diff = ifelse(is.na(pressure0), 0, obs - pressure0)) %>%
  filter(sta_id > 0 & !isoutlier) %>%
  group_by(sta_id) %>%
  mutate(sta_id = paste0(sta_id, " (SD=", round(sd(diff), 2), " ; N=", n(), ")")) %>%
  ggplot(aes(x = diff)) +
  geom_histogram(aes(y = (..count..) / tapply(..count.., ..PANEL.., sum)[..PANEL..]), binwidth = .2) +
  facet_wrap(~sta_id) +
  scale_x_continuous(name = "Pressure Geolocator - best match ERA5 (hPa)") +
  scale_y_continuous(name = "Normalized histogram")

Light

Show code
raw_geolight <- pam$light %>%
  transmute(
    Date = date,
    Light = obs
  )
lightImage(tagdata = raw_geolight, offset = 0)
tsimagePoints(twl$twilight,
  offset = 0, pch = 16, cex = 1.2,
  col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)

Show code
hist(z, freq = F)
lines(fit_z, col = "red")

The probability map resulting from light data alone can be seen below.

Show code
li_s <- list()
l <- leaflet(width = "100%") %>%
  addProviderTiles(providers$Stamen.TerrainBackground) %>%
  addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
  i_s <- metadata(light_prob[[i_r]])$sta_id
  info <- pam$sta[pam$sta$sta_id == i_s, ]
  info_str <- paste0(i_s, " | ", info$start, "->", info$end)
  li_s <- append(li_s, info_str)
  l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
  addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
  addLayersControl(
    overlayGroups = li_s,
    options = layersControlOptions(collapsed = FALSE)
  ) %>%
  hideGroup(tail(li_s, length(li_s) - 1))

Light vs Pressure

We can compare light and pressure location at long stationary stopover (>5 days). By assuming the best match of the pressure to be the truth, we can plot the histogram of the zenith angle and compare to the fit of kernel density at the calibration site.

Show code
 raw_geolight <- pam$light %>%
    transmute(
      Date = date,
      Light = obs
    )
 dur <- unlist(lapply(pressure_prob, function(x) difftime(metadata(x)$temporal_extent[2],metadata(x)$temporal_extent[1], units = "days" )))
  long_id <- which(dur>5)

  par(mfrow = c(2, 3))
  for (i_s in long_id){
    twl_fl <- twl %>%
      filter(!deleted) %>%
      filter(twilight>shortest_path_timeserie[[i_s]]$date[1] & twilight<tail(shortest_path_timeserie[[i_s]]$date,1))
    sun <-  solar(twl_fl$twilight)
    z_i <- refracted(zenith(sun, shortest_path_timeserie[[i_s]]$lon[1], shortest_path_timeserie[[i_s]]$lat[1]))
    hist(z_i, freq = F, main = paste0("sta_id=",i_s, " | ",nrow(twl_fl),"twls"))
    lines(fit_z, col = "red")
    xlab("Zenith angle")
  }

Similarly, we can plot the line of sunrise/sunset at the best match of pressure (yellow line) and compare to the raw and labeled light data.

Show code
  lightImage(
    tagdata = raw_geolight,
    offset = gpr$shift_k / 60 / 60
  )
  tsimagePoints(twl$twilight,
                offset = gpr$shift_k / 60 / 60, pch = 16, cex = 1.2,
                col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
  )
  for (ts in shortest_path_timeserie){
    twl_fl <- twl %>%
      filter(twilight>ts$date[1] & twilight<tail(ts$date,1))
    if (nrow(twl_fl)>0){
    tsimageDeploymentLines(twl_fl$twilight,
                           lon = ts$lon[1], ts$lat[1],
                           offset = gpr$shift_k / 60 / 60, lwd = 3,col = adjustcolor("orange", alpha.f = 0.5))
      
    }
  }

Stationay period information

Show code
read_csv(paste0("../reports/figure_print/table_transition/transition_", params$gdl_id, ".csv")) %>% kable() %>% scroll_box(width = "100%")
…1 sta_id_s sta_id_t flight_duration as_m as_s gs_m gs_s ws_m ws_s dist_m dist_s ws_m_support ws_m_drift start_flight end_flight sunrise sunset as_sp gs_sp ws_sp dist_sp ws_sp_support ws_sp_drift alt_min alt_max alt_mean alt_med alt_sumdabsdiff alt_sumposdiff gdl_id
1 1 2 9.5 68.50567 11.211278 73.93113 14.049061 18.509933 1.2633765 702.34575 133.46608 7.5435278 16.903042 2020-09-12 18:30:00 2020-09-13 04:00:00 2020-09-13 04:39:23 2020-09-12 18:17:54 63.21093 68.48592 17.948636 650.61624 7.4238156 16.3413738 227.20172 3866.1026 2234.6224 2356.26416 9114.36077 3480.13716 24TJ
2 2 3 5.0 57.68151 19.148988 75.66200 25.396751 25.666828 2.5722242 378.31001 126.98376 20.1975065 15.838143 2020-09-13 06:30:00 2020-09-13 11:30:00 2020-09-13 04:50:28 2020-09-12 18:06:06 42.19224 68.16630 26.187739 340.83148 26.0558150 2.6253011 228.17747 4599.9193 2869.3269 3322.20989 7903.80344 4424.71525 24TJ
3 3 4 1.0 33.40418 14.874228 37.09561 19.140369 16.910300 3.6549536 37.09561 19.14037 7.3620955 15.223593 2020-09-13 19:30:00 2020-09-13 20:30:00 2020-09-14 04:52:29 2020-09-13 18:11:26 18.10509 35.65502 18.108156 35.65502 17.8290698 3.1669532 597.57594 2461.1583 1445.2856 1277.12250 3047.61815 1184.03580 24TJ
4 4 5 3.0 36.81661 15.701165 41.63105 15.972214 9.310230 4.8773730 124.89315 47.91664 5.5771155 7.454942 2020-09-14 00:30:00 2020-09-14 03:30:00 2020-09-14 04:56:12 2020-09-13 18:12:14 34.58517 43.33119 8.793373 129.99356 8.7556027 0.8141450 597.17159 2083.3190 1026.6797 862.49996 3261.03326 1339.07772 24TJ
5 5 6 2.0 29.11889 14.414529 29.84360 15.693012 9.339993 3.9815135 59.68719 31.38602 2.1774534 9.082630 2020-09-15 02:30:00 2020-09-15 04:30:00 2020-09-15 04:56:18 2020-09-14 18:13:01 29.95124 29.98471 10.091218 59.96942 1.7315328 9.9415526 463.03476 723.6829 583.5318 605.20648 593.24386 303.79527 24TJ
6 6 7 1.0 30.46213 15.364966 33.76822 22.438686 22.567675 8.0399129 33.76822 22.43869 10.6853672 19.877698 2020-09-17 00:00:00 2020-09-17 01:00:00 2020-09-17 04:55:47 2020-09-16 18:08:46 29.30047 45.71334 28.132437 45.71334 22.1229271 17.3784377 486.59910 1812.9337 1039.0159 817.51491 2321.75347 995.41883 24TJ
7 7 8 1.0 31.33671 15.988738 30.84338 17.490623 7.862232 2.6454821 30.84338 17.49062 0.5048025 7.846010 2020-09-17 21:30:00 2020-09-17 22:30:00 2020-09-18 04:55:32 2020-09-17 18:05:18 25.49302 22.85669 7.107850 22.85669 -1.6831903 6.9056793 335.41378 1097.8759 604.5803 380.45140 1479.88653 762.46207 24TJ
8 8 9 1.0 34.35087 14.058293 34.08976 15.474316 10.341322 2.9034627 34.08976 15.47432 1.3064345 10.258468 2020-09-18 02:30:00 2020-09-18 03:30:00 2020-09-18 04:54:32 2020-09-17 18:04:18 27.35029 22.85669 4.507391 22.85669 -4.4908850 0.3853883 672.19037 721.2514 697.7677 699.86135 76.73199 27.67098 24TJ
9 9 10 1.0 33.83628 16.524877 34.42340 17.699623 11.683718 3.7257758 34.42340 17.69962 2.5649186 11.398704 2020-09-20 04:30:00 2020-09-20 05:30:00 2020-09-20 04:57:01 2020-09-19 18:00:24 22.95550 22.85669 6.808878 22.85669 0.9151403 6.7470983 837.47254 1251.9422 985.6784 867.62048 798.79141 414.46968 24TJ
10 10 11 1.0 30.62686 14.688338 30.94920 16.444604 7.335417 1.9999400 30.94920 16.44460 1.1899626 7.238255 2020-09-20 23:30:00 2020-09-21 00:30:00 2020-09-21 04:59:46 2020-09-20 17:59:57 34.14370 45.71334 12.194680 45.71334 11.7321072 3.3268427 460.92409 699.3934 570.7958 552.06996 238.46931 0.00000 24TJ
11 11 12 12.0 46.51071 16.531520 63.83885 20.270859 23.584902 5.0601650 766.06617 243.25031 19.3330533 13.508540 2020-10-06 17:30:00 2020-10-07 05:30:00 2020-10-07 05:18:20 2020-10-06 17:39:23 37.09288 57.63745 24.865781 691.64940 22.2468315 11.1079050 321.00253 1690.9010 767.9048 580.57490 4047.97619 2000.17516 24TJ
12 12 13 11.5 46.44488 19.191719 54.47701 21.815554 21.680683 3.1600494 626.48557 250.87887 11.7542161 18.217859 2020-10-07 17:30:00 2020-10-08 05:00:00 2020-10-08 05:21:42 2020-10-07 17:47:37 33.25189 39.49577 22.174000 454.20134 11.9748713 18.6624955 371.46414 3112.5577 1698.0337 1366.81636 7984.88730 4124.63785 24TJ
13 13 14 12.0 62.92404 23.365347 57.88466 25.466868 14.710501 3.4562010 694.61596 305.60242 -3.3895097 14.314680 2020-10-08 18:00:00 2020-10-09 06:00:00 2020-10-09 05:16:58 2020-10-08 17:51:45 62.54023 58.03141 12.314763 696.37696 -3.3773313 11.8425940 342.62310 2813.5275 1612.4725 1557.77997 11203.57371 5620.31680 24TJ
14 14 15 6.5 38.15665 17.182265 35.31358 15.906912 6.591965 3.3669920 229.53827 103.39493 -2.3422604 6.161803 2020-10-09 19:00:00 2020-10-10 01:30:00 2020-10-10 05:18:31 2020-10-09 17:50:02 36.04523 30.89426 5.989978 200.81270 -4.9996835 3.2989389 374.79849 3278.1649 1624.1663 1245.65922 9972.91088 5087.52048 24TJ
15 15 16 2.5 43.93101 18.723884 54.39589 21.812720 16.963220 10.8980398 135.98973 54.53180 12.1032183 11.885408 2020-10-10 20:00:00 2020-10-10 22:30:00 2020-10-11 05:18:11 2020-10-10 17:51:59 31.24910 55.33066 26.010869 138.32664 24.9548868 7.3361378 362.65844 942.1364 723.3969 833.88302 1203.06735 537.98905 24TJ
16 16 17 1.5 71.98613 17.240037 62.15373 18.058870 11.845968 3.6303824 93.23059 27.08830 -9.4812517 7.101606 2020-10-18 19:00:00 2020-10-18 20:30:00 2020-10-19 05:17:26 2020-10-18 17:47:29 50.73377 40.24034 13.281467 60.36052 -9.6698012 9.1045222 368.25377 1517.9827 942.8136 942.50892 1946.52733 796.79842 24TJ
17 17 18 1.5 73.82196 17.411332 72.28173 17.840899 6.316526 1.5030659 108.42260 26.76135 -1.2806390 6.185343 2020-10-18 23:30:00 2020-10-19 01:00:00 2020-10-19 05:13:56 2020-10-18 17:45:39 76.82179 77.15250 5.127330 115.72875 0.5003806 5.1028548 253.68327 2209.6823 1467.1975 1702.71227 2670.89280 714.89377 24TJ
18 18 19 1.5 46.17564 18.098262 54.26348 17.911905 9.609141 0.4517263 81.39522 26.86786 8.3359118 4.779976 2021-03-15 00:00:00 2021-03-15 01:30:00 2021-03-15 05:28:42 2021-03-14 18:15:01 31.83835 41.02852 9.232284 61.54278 9.1996196 0.7759281 244.51785 1053.1775 454.5647 260.28177 1621.29155 812.63194 24TJ
19 19 20 10.0 36.21764 12.935731 39.59609 13.811991 6.315683 1.1097989 395.96090 138.11991 3.7380034 5.090696 2021-04-05 19:00:00 2021-04-06 05:00:00 2021-04-06 05:00:39 2021-04-05 18:16:25 48.83250 54.09018 6.447363 540.90177 5.3863981 3.5433324 923.90532 2692.8838 2026.4852 2002.65509 5313.09332 3181.80639 24TJ
20 20 21 11.0 59.37369 17.486610 70.17183 19.313416 14.020768 3.3889883 771.89008 212.44757 11.3680346 8.206687 2021-04-06 18:30:00 2021-04-07 05:30:00 2021-04-07 04:44:22 2021-04-06 18:09:18 49.75959 65.71729 19.768409 722.89017 16.9935104 10.1000288 877.01580 3611.4430 2398.6763 2603.12871 9509.93624 4744.20170 24TJ
21 21 22 10.0 64.66206 11.632102 72.42727 15.838982 33.413167 3.0504128 724.27272 158.38982 15.0562547 29.828659 2021-04-07 18:30:00 2021-04-08 04:30:00 2021-04-08 04:32:09 2021-04-07 18:03:08 51.02528 65.42088 29.796649 654.20884 19.5973570 22.4451302 1813.75866 4306.0621 3312.8311 3511.58491 6399.06983 3397.79896 24TJ
22 22 23 3.0 38.62514 15.205174 37.97091 17.550106 27.657199 7.6512635 113.91273 52.65032 9.4125948 26.006224 2021-04-08 07:00:00 2021-04-08 10:00:00 2021-04-08 04:37:09 2021-04-07 18:02:16 30.61794 40.15194 26.441882 120.45581 17.1086741 20.1610124 364.36121 2681.5796 1797.1970 2119.10966 4597.29045 1987.32893 24TJ
23 23 24 10.0 52.92498 8.896628 65.63904 7.340879 24.380916 5.5238506 656.39037 73.40879 16.0107360 18.387099 2021-04-08 19:00:00 2021-04-09 05:00:00 2021-04-09 04:52:53 2021-04-08 18:07:55 48.60258 64.71294 26.278961 647.12939 19.4407573 17.6816505 447.09260 2513.9288 1445.3139 1342.31349 4903.47869 2036.78706 24TJ
24 24 25 2.5 33.48073 15.719081 53.87568 17.168186 31.651796 3.1010335 134.68920 42.92047 25.8322996 18.290120 2021-04-09 21:00:00 2021-04-09 23:30:00 2021-04-10 04:52:02 2021-04-09 18:33:43 31.76260 58.42771 31.518094 146.06928 29.0814468 12.1515296 637.33185 2058.2280 1297.0106 1289.80832 3295.66100 2033.42771 24TJ
25 25 26 1.5 29.60140 14.036631 28.83389 18.123066 18.574325 1.8497360 43.25083 27.18460 5.2049169 17.830154 2021-04-19 20:30:00 2021-04-19 22:00:00 2021-04-20 04:39:03 2021-04-19 18:45:50 31.62275 18.49010 16.402577 27.73514 -10.5210459 12.5838039 1462.68739 2515.1737 1891.1520 1793.37340 1995.52079 1052.48634 24TJ
26 26 27 19.5 42.57303 2.098639 47.60055 3.574760 25.948292 2.8505502 928.21072 69.70781 11.8345637 23.092358 2021-04-26 19:30:00 2021-04-27 15:00:00 2021-04-27 04:04:02 2021-04-26 18:51:31 42.72126 47.79694 24.038324 932.04042 10.8509359 21.4499005 82.87552 4171.8905 1463.4545 354.60281 9425.18278 3937.41825 24TJ
27 27 28 1.0 41.83520 20.793779 43.05717 22.070364 10.492949 6.7143107 43.05717 22.07036 2.4831859 10.194889 2021-04-27 22:30:00 2021-04-27 23:30:00 2021-04-28 04:04:28 2021-04-27 19:03:04 30.62566 40.68768 17.196303 40.68768 12.4517948 11.8602548 49.62742 600.4806 390.2888 520.75850 550.85313 0.00000 24TJ
28 28 29 1.5 56.48140 15.840073 59.58734 15.601034 4.282497 1.3862099 89.38101 23.40155 3.1788852 2.869577 2021-04-29 20:30:00 2021-04-29 22:00:00 2021-04-30 04:02:00 2021-04-29 19:07:35 41.80465 45.83917 4.044716 68.75876 4.0354252 0.2739962 236.82695 750.8394 441.5925 389.35189 1284.40022 514.01243 24TJ
29 29 30 1.0 34.99566 16.540956 29.80588 16.806436 20.336554 5.9733312 29.80588 16.80644 1.2962184 20.295202 2021-05-01 20:00:00 2021-05-01 21:00:00 2021-05-02 03:58:57 2021-05-01 19:13:33 24.02671 0.00000 24.026707 0.00000 NA NA -4.65015 561.0796 210.9081 76.29495 1050.51430 565.72970 24TJ
30 30 31 5.5 67.99718 9.308357 73.23292 10.541809 5.788574 1.9948078 402.78107 57.97995 5.2773549 2.378470 2021-05-03 20:00:00 2021-05-04 01:30:00 2021-05-04 03:36:47 2021-05-03 19:16:08 59.08333 62.69978 5.336288 344.84881 3.7392399 3.8071052 1012.13575 2374.1139 1776.1456 1806.17946 5153.22260 3175.84588 24TJ